//
//  WatchListResponseData.m
//  Kids
//
//  Created by LiTengFei on 14/11/26.
//  Copyright (c) 2014年 90's Technology Co.Ltd. All rights reserved.
//

#import "WatchListResponseData.h"

@implementation WatchListResponseData

@synthesize modelList = modelList;

- (void)analyse:(NSDictionary*)data
{

    NSParameterAssert(data);

    [super analyse:data];

    id object = [data objectForKey:@"info"];

    if ([object isKindOfClass:[NSArray class]]) {
        //解析数组
        NSArray* arr = (NSArray*)object;

        NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity:0];
        for (NSDictionary* dict in arr) {

            WatchModel* model = [[WatchModel alloc] init];
            [model setValuesForKeysWithDictionary:dict];
            [array addObject:model];
        }
        self.modelList = [array copy];
        self.info = @"";
    }
    else {
        self.info = (NSString*)object;
        self.modelList = [NSMutableArray array];
    }
}

@end
